<template>
	<el-dialog title="流程收回话框" v-model="visible" :width="500" destroy-on-close @closed="$emit('closed')">
		<el-form :model="form" :rules="rules" :disabled="mode=='show'" ref="dialogForm" label-width="100px" label-position="left">
			<el-form-item label="流程名称">
				{{flowTitle}}
			</el-form-item>
			<el-table :data="stepRunList" border stripe style="width: 100%"  class="customer-table">
				<el-table-column prop="stepName" width="200" label="步骤名称">
					<template #default="scope">
						<el-radio v-model="form.stepRunId" :label="scope.row.stepRunId">{{scope.row.stepName}}</el-radio>
					</template>
				</el-table-column>
				<el-table-column prop="createTime" width="180" align="center" label="创建时间"></el-table-column>
				<el-table-column prop="recTime" align="center" width="80" fixed="right" label="是否接收">
					<template #default="scope">
						<el-tag v-if="scope.row.recTime!=''" type="success">已接收</el-tag>
						<el-tag v-else type="warning">未接收</el-tag>
					</template>
				</el-table-column>
			</el-table>
		</el-form>
		<template #footer>
			<el-button @click="visible=false">取 消</el-button>
			<el-button v-if="mode!='show'" type="primary" :loading="isSaveing" @click="submit()">确 定</el-button>
		</template>
	</el-dialog>
</template>

<script>
export default {
	components: {
	},
	emits: ['success', 'closed'],
	data() {
		return {
			visible: false,
			isSaveing: false,
			flowTitle: '',
			stepRunList:[],
			//表单数据
			form: {
				runId:'',
				runStepId:''
			},
			//验证规则
			rules: {}
		}
	},
	mounted() {

	},
	methods: {
		//显示
		open() {
			this.visible = true;
			return this
		},
		async submit() {
			var res = await this.$API.bpm.bpmStepRun.doTaskBack.post(this.form);
			if (res.code == 200) {
				this.$emit('success')
				this.$message.success("操作成功")
			} else {
				this.$alert(res.message, "提示", {type: 'error'})
			}
			this.visible = false;
		},
		setData(data)
		{
			this.form.runId = data.runId;
			this.flowTitle=data.flowTitle;
			this.getCanTaskBackBpmStepRunList();
		},
		async getCanTaskBackBpmStepRunList()
		{
			var res = await this.$API.bpm.bpmStepRun.getCanTaskBackBpmStepRunList.get(this.form);
			if (res.code == 200) {
				this.stepRunList = res.data;
			} else {
				this.$alert(res.message, "提示", {type: 'error'})
			}
		}
	}
}
</script>

<style>
</style>
